//||=========================================================================||
//||                                                                         ||
//||                        SimpleMandelbrotCounter.h                        ||
//||                                                                         ||
//||                           by the_best_goose))                           ||
//||                                                                         ||
//||=========================================================================||

#include <QThread>
#include <QRectF>
#include <QRgb>
#include "IMandelbrotCounter.h"

#ifndef SIMPLEMANDELBROTCOUNTER_H_
#define SIMPLEMANDELBROTCOUNTER_H_

//-----------------------------------------------------------------------------

class SimpleMandelbrotCounter : public IMandelbrotCounter
{
    Q_OBJECT
public:

    SimpleMandelbrotCounter(const MainWindow* pwind, const QWidget* pmand_pic);
    ~SimpleMandelbrotCounter();

    void Init(QRgb* pixels, int y_trans, int x_before, int x_after,
              const QSize& px_rect, const QRectF& graph_rect);

signals:

    void Counted();
    void NeedRecount();

public slots:

    void SetIterationsCount(int count);

protected:

    void run();

private:

    void GenIndexes();
    inline QRgb GetColor();

protected:

    int iters_count_;

    QSize px_size_;
    QRectF graph_rect_;
    QRgb* pixels_;

    int y_trans_;
    int x_before_;
    int x_after_;

    int iters_;
    QRgb* index_array_;

    bool break_;

    };

//-----------------------------------------------------------------------------

#endif // SIMPLEMANDELBROTCOUNTER_H_
